import config from "@/config"
import http from "@/utils/request"

export default {

	/**
	 * 系统菜单
	 */
	menu: {
		myMenus: {
			url: `${config.API_URL}/backstage/auth-api/menu/tree/csui`,
			name: "获取我的菜单",
			get: async function(){
				return await http.get(this.url);
			}
		},
		list: {
			url: `${config.API_URL}/system/menu/list`,
			name: "获取菜单",
			get: async function(){
				return await http.get(this.url);
			}
		}
	},

	/**
	 * 用户管理
	 */
	user: {
		list: {
			url: `${config.API_URL}/backstage/auth-api/user/list`,
			name: "获取用户列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		add: {
			url: `${config.API_URL}/backstage/auth-api/user/add`,
			name: "新增用户信息",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		edit: {
			url: `${config.API_URL}/backstage/auth-api/user/edit`,
			name: "编辑用户信息",
			put: async function(params){
				return await http.put(this.url, params);
			}
		},
		del: {
			url: `${config.API_URL}/backstage/auth-api/user/delete`,
			name: "删除用户信息",
			delete: async function(params){
				return await http.delete(this.url, params);
			}
		},
		delBatch: {
			url: `${config.API_URL}/backstage/auth-api/user/batch/delete`,
			name: "批量删除用户信息",
			delete: async function(params){
				return await http.delete(this.url, params);
			}
		},
		exportList: {
			url: `${config.API_URL}/backstage/auth-api/user/export/list`,
			name: "导出用户列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		refreshPwd: {
			url: `${config.API_URL}/backstage/auth-api/user/reset/password`,
			name: "重置用户密码",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		offline: {
			url: `${config.API_URL}/backstage/auth-api/user/online/kickout`,
			name: "强制用户下线",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		archives: {
			url: `${config.API_URL}/backstage/auth-api/user/export/info/pdf`,
			name: "导出用户下线",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		uploadHeadPortrait : {
			url: `${config.API_URL}/backstage/auth-api/user/uploadFile/headPortrait`,
			name: "上传用户头像",
			post: async function(data, config={}){
				return await http.post(this.url, data, config);
			}
		},
		downloadTemplate: {
			url: `${config.API_URL}/backstage/auth-api/user/import/download/template`,
			name: "下载导入模版文件",
			get: async function(params){
				return await http.get_download(this.url, params, {responseType: 'blob'});
			}
		},
		uploadImportFile: {
			url: `${config.API_URL}/backstage/auth-api/user/import/upload/file`,
			name: "上传批量用户导入文件",
			post: async function(data, config={}) {
				return await http.post(this.url, data, config);
			}
		},
		analysis: {
			url: `${config.API_URL}/backstage/auth-api/user/import/file/handle`,
			name: "解析用户导入文件",
			get: async function(params){
				return await http.get(this.url, params);
			}
		}
	},

	/**
	 * 角色管理
	 */
	role: {
		list: {
			url: `${config.API_URL}/backstage/auth-api/role/list`,
				name: "获取角色列表",
				get: async function(params){
				return await http.get(this.url, params);
			}
		},
		add: {
			url: `${config.API_URL}/backstage/auth-api/role/add`,
			name: "新增角色信息",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		edit: {
			url: `${config.API_URL}/backstage/auth-api/role/edit`,
			name: "编辑角色信息",
			put: async function(params){
				return await http.put(this.url, params);
			}
		},
		del: {
			url: `${config.API_URL}/backstage/auth-api/role/delete`,
			name: "删除角色信息",
			delete: async function(params){
				return await http.delete(this.url, params);
			}
		},
		delBatch: {
			url: `${config.API_URL}/backstage/auth-api/role/batch/delete`,
			name: "批量删除角色信息",
			delete: async function(params){
				return await http.delete(this.url, params);
			}
		},
		exportList: {
			url: `${config.API_URL}/backstage/auth-api/role/export/list`,
			name: "导出角色列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		listAll: {
			url: `${config.API_URL}/backstage/auth-api/role/list/all`,
				name: "获取所有角色列表",
				get: async function(params){
				return await http.get(this.url, params);
			}
		},
		downloadTemplate: {
			url: `${config.API_URL}/backstage/auth-api/role/import/download/template`,
			name: "下载导入模版文件",
			get: async function(params){
				return await http.get_download(this.url, params, {responseType: 'blob'});
			}
		},
		uploadImportFile: {
			url: `${config.API_URL}/backstage/auth-api/role/import/upload/file`,
			name: "上传批量用户导入文件",
			post: async function(data, config={}) {
				return await http.post(this.url, data, config);
			}
		},
		analysis: {
			url: `${config.API_URL}/backstage/auth-api/role/import/file/handle`,
			name: "解析用户导入文件",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		getMenuList: {
			url: `${config.API_URL}/backstage/auth-api/permission/tree/all`,
			name: "获取所有权限/菜单Tree结构",
			get: async function(params){
				return await http.get(this.url, params);
			}
		}
	},

	/**
	 * 资源/菜单管理
	 */
	permission: {
		list: {
			url: `${config.API_URL}/backstage/auth-api/permission/tree`,
			name: "获取资源列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		add: {
			url: `${config.API_URL}/backstage/auth-api/permission/add`,
			name: "新增资源信息",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		edit: {
			url: `${config.API_URL}/backstage/auth-api/permission/edit`,
			name: "编辑资源信息",
			put: async function(params){
				return await http.put(this.url, params);
			}
		},
		del: {
			url: `${config.API_URL}/backstage/auth-api/permission/delete`,
			name: "删除资源信息",
			delete: async function(params){
				return await http.delete(this.url, params);
			}
		},
		listAll: {
			url: `${config.API_URL}/backstage/auth-api/permission/tree/all`,
			name: "获取所有资源列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		}
	},

	/**
	 * 系统日志
	 */
	log: {
		list: {
			url: `${config.API_URL}/backstage/log-api/operateLog/list`,
			name: "日志列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		statistics: {
			url: `${config.API_URL}/backstage/log-api/operateLog/statistics`,
			name: "日志列表统计",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		exportList: {
			url: `${config.API_URL}/backstage/log-api/operateLog/export/list`,
			name: "导出日志列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
	},

	/**
	 * 定时任务
	 */
	task: {
		list: {
			url: `${config.API_URL}/backstage/job-api/job/list`,
			name: "定时任务列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		add: {
			url: `${config.API_URL}/backstage/job-api/job/add`,
			name: "新增定时任务信息",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		edit: {
			url: `${config.API_URL}/backstage/job-api/job/edit`,
			name: "编辑定时任务信息",
			put: async function(params){
				return await http.put(this.url, params);
			}
		},
		del: {
			url: `${config.API_URL}/backstage/job-api/job/delete`,
			name: "删除定时任务信息",
			delete: async function(params){
				return await http.delete(this.url, params);
			}
		},
		switch: {
			url: `${config.API_URL}/backstage/job-api/job/switch`,
			name: "启动|停止定时任务",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		log: {
			url: `${config.API_URL}/backstage/job-api/job/log`,
			name: "查询定时任务日志列表",
			get: async function(params){
				if(params.jobId == -1){
					return null;
				}
				return await http.get(this.url, params);
			}
		},
		nextTriggerTime: {
			url: `${config.API_URL}/backstage/job-api/job/nextTriggerTime`,
			name: "查询cron表达式即将执行的时间列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		trigger: {
			url: `${config.API_URL}/backstage/job-api/job/trigger`,
			name: "触发一次任务调度",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		statistics: {
			url: `${config.API_URL}/backstage/job-api/job/statistics`,
			name: "统计指定job任务的成功数｜失败数",
			get: async function(params){
				return await http.get(this.url, params);
			}
		}
	},

	/**
	 * 系统参数
	 */
	params: {
		/********************************** 系统参数 **********************************/
		getSystemConfigureInfo: {
			url: `${config.API_URL}/backstage/auth-api/params/system/info`,
			name: "获取系统配置信息",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		editSystemConfigureInfo: {
			url: `${config.API_URL}/backstage/auth-api/params/system/edit`,
			name: "编辑系统参数配置信息",
			put: async function(params){
				return await http.put(this.url, params);
			}
		},
		uploadPicture: {
			url: `${config.API_URL}/backstage/auth-api/params/uploadFile/picture`,
			name: "	上传文件横幅｜logo",
			post: async function(data, config={}){
				return await http.post(this.url, data, config);
			}
		},

		/********************************** Naocs参数 **********************************/
		getNacosList:{
			url: `${config.API_URL}/backstage/auth-api/params/nacos/list`,
			name: "获取Nacos数据列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		editNacosInfo:{
			url: `${config.API_URL}/backstage/auth-api/params/nacos/edit`,
			name: "编辑Nacos信息",
			put: async function(params){
				return await http.put(this.url, params);
			}
		},
		addNacosInfo:{
			url: `${config.API_URL}/backstage/auth-api/params/nacos/add`,
			name: "新增Nacos信息",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		delNacosInfo: {
			url: `${config.API_URL}/backstage/auth-api/params/nacos/delete`,
			name: "删除Nacos信息",
			delete: async function(params){
				return await http.delete(this.url, params);
			}
		},

		/********************************** TPS参数 **********************************/
		getOtherList:{
			url: `${config.API_URL}/backstage/auth-api/params/other/list`,
			name: "获取其他配置参数列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		editOtherInfo:{
			url: `${config.API_URL}/backstage/auth-api/params/other/edit`,
			name: "编辑其他配置参数",
			put: async function(params){
				return await http.put(this.url, params);
			}
		},
		addOtherInfo:{
			url: `${config.API_URL}/backstage/auth-api/params/other/add`,
			name: "新增其他配置参数",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		delOtherInfo: {
			url: `${config.API_URL}/backstage/auth-api/params/other/delete`,
			name: "删除其他配置参数",
			delete: async function(params){
				return await http.delete(this.url, params);
			}
		},
	},

	dic: {
		list: {
			url: `${config.API_URL}/system/dic/list`,
			name: "字典明细",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		get: {
			url: `${config.API_URL}/system/dic/get`,
			name: "获取字典数据",
			get: async function(params){
				return await http.get(this.url, params);
			}
		}
	},

}
